package com.ruoyi.smartcity.traffic.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.smartcity.traffic.mapper.TrafficRoadStateMapper;
import com.ruoyi.smartcity.traffic.domain.TrafficRoadState;
import com.ruoyi.smartcity.traffic.service.ITrafficRoadStateService;

/**
 * 道路状态Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-24
 */
@Service
public class TrafficRoadStateServiceImpl implements ITrafficRoadStateService 
{
    @Autowired
    private TrafficRoadStateMapper trafficRoadStateMapper;

    /**
     * 查询道路状态
     * 
     * @param id 道路状态主键
     * @return 道路状态
     */
    @Override
    public TrafficRoadState selectTrafficRoadStateById(Long id)
    {
        return trafficRoadStateMapper.selectTrafficRoadStateById(id);
    }

    /**
     * 查询道路状态列表
     * 
     * @param trafficRoadState 道路状态
     * @return 道路状态
     */
    @Override
    public List<TrafficRoadState> selectTrafficRoadStateList(TrafficRoadState trafficRoadState)
    {
        return trafficRoadStateMapper.selectTrafficRoadStateList(trafficRoadState);
    }

    /**
     * 新增道路状态
     * 
     * @param trafficRoadState 道路状态
     * @return 结果
     */
    @Override
    public int insertTrafficRoadState(TrafficRoadState trafficRoadState)
    {
        trafficRoadState.setCreateTime(DateUtils.getNowDate());
        return trafficRoadStateMapper.insertTrafficRoadState(trafficRoadState);
    }

    /**
     * 修改道路状态
     * 
     * @param trafficRoadState 道路状态
     * @return 结果
     */
    @Override
    public int updateTrafficRoadState(TrafficRoadState trafficRoadState)
    {
        trafficRoadState.setUpdateTime(DateUtils.getNowDate());
        return trafficRoadStateMapper.updateTrafficRoadState(trafficRoadState);
    }

    /**
     * 批量删除道路状态
     * 
     * @param ids 需要删除的道路状态主键
     * @return 结果
     */
    @Override
    public int deleteTrafficRoadStateByIds(Long[] ids)
    {
        return trafficRoadStateMapper.deleteTrafficRoadStateByIds(ids);
    }

    /**
     * 删除道路状态信息
     * 
     * @param id 道路状态主键
     * @return 结果
     */
    @Override
    public int deleteTrafficRoadStateById(Long id)
    {
        return trafficRoadStateMapper.deleteTrafficRoadStateById(id);
    }

    @Override
    public long count() {
        return trafficRoadStateMapper.count();
    }
}
